package com.igeek.clud_system.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogoutController {

    @RequestMapping("logout")
    public String logout(HttpSession session) {
        System.out.println("清除session");
        // 清除session
        if (session != null) {
            session.invalidate();
        }
        return "redirect:/login"; // 重定向到登录页面或其他页面
    }
}
